package top.purity.framework.common;

/**
 * @version 1.0
 * @Author Lmh
 * @Description
 * @CreateTime 2023-10-27 21:41
 */
public class UserContextHolder {

    private static final ThreadLocal<Long> USER_ID = new ThreadLocal<>();

    public static void setUserId(Long userId) {
        USER_ID.set(userId);
    }

    public static Long getUserId() {
        return USER_ID.get();
    }

    public static void clear() {
        USER_ID.remove();
    }

}
